home *** CD-ROM | disk | FTP | other *** search
- ;**************************************************************
- ;
- ; dprog.asm
- ;
- ; staff
- ;
- ; 06-04-91
- ;
- ; (C) Texas Instruments Inc., 1992
- ;
- ; Refer to the file 'license.txt' included with this
- ; this package for usage and license information.
- ;
- ;**************************************************************
- Example 7-xx. Backtracking Algorithm Using Circular
- Addressing
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Backtracking Example
- ; This program back-tracks the optimal path expanded by
- ; a dynamic programming algorithm. The path history
- ; consists of four paths expanded N times. It is set up
- ; as a circular buffer of length N*4.
- ; Note that decrement type circular buffer is used.
- ; The start and end address of the circular buffer are
- ; initialized this way because of two reasons:
- ; 1- to avoid skipping the end-address of circ buffer
- ; 2- to ensure that wrap-around is complete before next
- ; iteration.
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- LAR AR0,#BUFFER ; get buffer address
- LMMR INDX,PATH ; get the selected path [0..3]
- SPLK #N-1,BRCR ; trace back N time periods
- * init. AR0 as pointer to circular buffer#1; length=N*4
- words
- SPLK #BUFFER+(N-1)*4,CBSR1
- SPLK #BUFFER-3,CBER1
- SPLK #08h,CBCR
- *
- RPTB TLOOP-1 ; for i=0,i<N,i++
- MAR *0+ ; offset by state#
- LACC *0- ; get next pointer & reset to state#0
- SAMM INDX ; save next state#
- SBRK 3 ; decrement AR0 to avoid skipping
- CBER1
- SBRK 1 ; now AR0 is correctly positioned 1
- time
- TLOOP: ; period back (circular addressing)
-
-